/**
 * Created by lbs on 2017/3/9.
 */

var app = angular.module('myApp', ['ngRoute']);


$(function () {
    getAdmin();
    quit();
    function getAdmin() {
        var role = localStorage.getItem('role');
        var name = localStorage.getItem('name');
        if (name == null) {
            name = '';
        }
        $('.header_right .name').text(name);


        switch (role) {
            case 'S':
                $('.left ul li.super').show();
                break;
            case '0':
                $('.left ul li.zero').show();
                break;
            case '1':
                $('.left ul li.one').show();
                break;
            case '2':
                $('.left ul li.two').show();
                break;
            case '3':
                $('.left ul li.three').show();
                break;
            case '4':
                $('.left ul li.four').show();
                break;
            case '5':
                $('.left ul li.five').show();
        }
    }

//    退出登录
    function quit() {

        $('.quit').click(function () {
            if (confirm('确定要退出吗?')) {
                $.ajax({
                    type: 'GET',
                    url: '/management/admin/logout',
                    success: function (data) {
                        console.log(data);
                        if (data.result == true) {
                            window.location.href = 'login.html';
                        } else {
                            alert(data.message);
                        }
                    }
                })
            }
        })

    }

    //var url = window.location.origin;
    var url = window.location.href;

    if(url.indexOf('test') > 0){
        window.reqUrl = 'http://101.37.32.213:18080/dm';
    }else{
        //window.reqUrl = 'http://101.37.32.213:18080/dm';
       window.reqUrl = 'http://101.37.32.213/dm';
    }


})
